package com.android.wnba.activity;

import com.android.wnba.R;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.widget.TabHost;

public class TabMainActivity extends TabActivity {

	TabHost tabHost;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_tab_main);
		initViews();
	}

	void initViews() {
		tabHost = getTabHost();
		addTabs();
	}

	void addTabs() {
		Resources res = getResources();
		Drawable mTabIcon1 = res.getDrawable(R.drawable.tab1_n);
		Drawable mTabIcon2 = res.getDrawable(R.drawable.tab2_n);
		Drawable mTabIcon3 = res.getDrawable(R.drawable.tab3_n);
		Drawable mTabIcon4 = res.getDrawable(R.drawable.tab4_n);

		String mTabLabel1 = res.getString(R.string.tabmain_btn_tab1);
		String mTabLabel2 = res.getString(R.string.tabmain_btn_tab2);
		String mTabLabel3 = res.getString(R.string.tabmain_btn_tab3);
		String mTabLabel4 = res.getString(R.string.tabmain_btn_tab4);

		tabHost.addTab(tabHost
				.newTabSpec("tab1")
				.setIndicator(mTabLabel1, mTabIcon1)
				.setContent(
						new Intent(this, Tab1Activity.class)
								.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)));
		tabHost.addTab(tabHost
				.newTabSpec("tab2")
				.setIndicator(mTabLabel2, mTabIcon2)
				.setContent(
						new Intent(this, Tab2Activity.class)
								.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)));
		tabHost.addTab(tabHost
				.newTabSpec("tab3")
				.setIndicator(mTabLabel3, mTabIcon3)
				.setContent(
						new Intent(this, Tab3Activity.class)
								.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)));
		tabHost.addTab(tabHost
				.newTabSpec("tab4")
				.setIndicator(mTabLabel4, mTabIcon4)
				.setContent(
						new Intent(this, Tab4Activity.class)
								.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)));

		// tabHost.addTab(tabHost.newTabSpec("TAB_HOME").setIndicator("TAB_HOME")
		// .setContent(new Intent(this, Tab1Activity.class)));
		// tabHost.addTab(tabHost.newTabSpec("TAB_ATME").setIndicator("TAB_ATME")
		// .setContent(new Intent(this, Tab2Activity.class)));
		// tabHost.addTab(tabHost.newTabSpec("TAB_NEWBLOG")
		// .setIndicator("TAB_NEWBLOG")
		// .setContent(new Intent(this, Tab3Activity.class)));
		// tabHost.addTab(tabHost.newTabSpec("TAB_MESSAGE")
		// .setIndicator("TAB_MESSAGE")
		// .setContent(new Intent(this, Tab4Activity.class)));
	}
}
